package com.imxplus.example01

import akka.actor.Actor
import akka.event.Logging
import com.imxplus.example01.Messages.{BoilWater, TurnOnLight}

class RobotActor extends Actor {

  val log = Logging(context.system, this)


  override def receive: Receive = {
    case m: TurnOnLight => {
      log.info("{} after {} hour", m.message, m.time)
      Thread.sleep(m.time * 1000)
    }
    case m: BoilWater => {
      log.info("{} after {} hour", m.message, m.time)
      Thread.sleep(m.time * 1000)
    }
    case o => log.info("I cannot handle this message: {}", o)
  }
}
